<?php
	session_start(); header("Cache-control: private");
	
	$user = $_SESSION['username'];
	$importo = $_GET['importo'];
	$_SESSION['importo'] = $importo;
	include '../wp-includes/php/DBManager.class.php';
	$db = new DBManager ( 'localhost', 'root', '', 'iumus' );
	$query="SELECT Saldo FROM iumus.utente WHERE  utente.Username =  '".$user ."';";
	$result=$db->executeQuery ($query);
	$row = mysql_fetch_array($result);
	
	$query="UPDATE iumus.utente SET Saldo =  '".($importo + $row['Saldo'])."' WHERE  utente.Username =  '".$user ."';";
	
	$result=$db->executeQuery ($query);
			
	header("Location: chpage.php"); 
?>